import * as React from 'react';
import { useMount } from 'ahooks';
import { connect, ConnectRC } from 'umi';
import { Table, Space, Button } from 'antd'
export interface IAdminListProps {
}

const AdminList: ConnectRC<IAdminListProps> = (props) => {
  useMount(() => {
    props.dispatch({
      type: 'account/getAdminListReq'
    })
  })
  const columns = [
    {
      title:"序号"
    },
    {
      title:"管理员名称",
      dataIndex: "adminname"
    },
    {
      title: '操纵',
      render () {
        return <Space>
        <Button type="primary">编辑</Button>
        <Button danger>删除</Button>
     </Space>
      }
    }
  ]
  return (
    <div>
      <Table dataSource = { props.adminList} columns = { columns }/>
    </div>
  );
}
export default connect(({ account }) => {
  return {
    adminList: account.adminList
  }
})(AdminList)
